<?php
JunctionFileCabinet::using("Junction_Builder_Collection");
JunctionFileCabinet::using("Junction_Utils_Reflection_Facade");
JunctionFileCabinet::using("Junction_Utils_Xml_Exception");
JunctionFileCabinet::using("Junction_Utils_Xml_Handler");
JunctionFileCabinet::using("Junction_Utils_Xml_Parser");

class Junction_Builder_Handlers_ManyToMany implements Junction_Utils_Xml_Handler {
	
	/**
	 * 
	 * @throws Junction_Utils_Xml_Exception
	 */
	public function handle(SimpleXMLElement $root) {
		$many = Junction_Utils_Reflection_Facade::getInstance("Junction_Builder_ManyToMany", 
				array(Junction_Utils_Xml_Parser::collectAttributes($root)));
				
		$children = Junction_Utils_Xml_Parser::parse($root);
		$many->columns = $children->get("column");
		return $many;
	}
}
?>